package work;

public class Car {
    /**
     * 汽车的属性
     */
    private String carName;//汽车品牌
    private String carColor;//汽车颜色
    private int carSpeed;//汽车速度
    /**
     * 封装
     */
    public String getCarName() {
        return carName;
    }
    public String getCarColor() {
        return carColor;
    }
    public int getCarSpeed() {
        return carSpeed;
    }
    public void setCarSpeed(int carSpeed) {
        this.carSpeed = carSpeed;
    }
    /**
     * 构造方法
     */
    public  Car(){}
    public Car(String carName, String carColor, int carSpeed) {
        this.carName = carName;
        this.carColor = carColor;
        this.carSpeed = carSpeed;
    }

    /**
     * 撞击
     */
    public void doDrive(){
        System.out.println("一辆"+carColor+"的"+carName+"汽车在每小时"+carSpeed+"速度下行驶");
    }
}
